<template>
  <div class="dropdown">
    <select v-model="selectedOption" @change="handleSelection">
      <option v-for="option in dropdownOptions" :value="option.value">{{ option.name }}</option>
    </select>
  </div>
</template>

<script>
import { getAction } from '@/api/manage'
export default {
  data() {
    return {
      selectedOption: '',
      dropdownOptions: [],
    }
  },
  mounted() {
    this.evaluateSelect()
  },
  methods: {
    handleSelection() {
      this.$emit('option-selected', this.selectedOption)
    },

    async evaluateSelect() {
      let { result } = await getAction('/sys/home/evaluate_select')
      this.dropdownOptions = result
      this.selectedOption = result[0].value
      this.handleSelection()
    },
  },
}
</script>

<style scoped lang="less">
/* 样式可以根据需要自行调整 */
select {
  width: 117px;
  height: 22px;
  line-height: 22px;
  background: rgba(4, 99, 103, 0.4);
  border: 1px solid #036569;
  border-radius: 4px;
  outline: none;
  font-size: 12px;
  font-family: PingFang SC;
  font-weight: 500;
  color: #00c6cc;
  padding-left: 10px;
  cursor: pointer;

  option {
    color: #00d9df;
    background: #025050;
    &:hover {
      color: red;
    }
  }
}
</style>
